﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid;
using ActionServices;
namespace SchoolManagementSystem.Controls
{
    class SetGroupColumn
    {
        public static void SetGroupOperator(object Model, GridView gridView1, string Operator)
        {
            switch (Operator)

            {
                case "Count":
                
                    break;
                case "Avegare":
                    if (Model.GetType() == typeof(Student_ResultDetailActionService))
                    {
                        if (gridView1.GroupSummary.Count <= 0)
                        {
                            GridGroupSummaryItem item = new GridGroupSummaryItem();
                            item.FieldName = "Value";
                            item.SummaryType = DevExpress.Data.SummaryItemType.Average;
                            gridView1.GroupSummary.Add(item);
                        }
                    }
                    break;
                case "Sum":
                    if (Model.GetType() == typeof(Receipt_VoucherFeeActionService))
                    {
                        if (gridView1.GroupSummary.Count <= 0)
                        {
                            GridGroupSummaryItem item = new GridGroupSummaryItem();
                            item.FieldName = "Money";
                            item.SummaryType = DevExpress.Data.SummaryItemType.Sum;
                            item.DisplayFormat = "Tổng cộng {0:c1}";
                            gridView1.GroupSummary.Add(item);
                        }
                    }
                    break;
            }
        }
    }
}
